<script setup>
import {computed} from 'vue'

const startData = defineModel("start",{default: '', type: String})

const endDate = defineModel("end",{default: '', type: String,})

const searchDate = computed({
    get: () => {
        return [startData.value ?? '', endDate.value ?? '']
    },
    set: (value) => {
        if (!value) {
            startData.value = ''
            endDate.value = ''
        } else {
            startData.value = value[0]
            endDate.value = value[1]
        }
    }
})

</script>

<template>
    <a-range-picker
        v-model="searchDate"
        :placeholder="['开始日期', '结束日期']"
        allow-clear
        format="YYYY-MM-DD"
        value-format="YYYY-MM-DD"
    />
</template>

<style scoped>

</style>
